package A;

import jdk.nashorn.internal.codegen.CompilerConstants;

public class test {
    public static void main(String[] args) {
        Animal animal01 = new Dog();
        Animal animal02 = new Cat();
/*        AnimalCall(animal01);
        AnimalCall(animal02);*/
        Animal[] animals = {animal01,animal02,animal01,animal02,animal01};
        for (Animal x: animals) {
            AnimalCall(x);
        }
    }
    public static void AnimalCall(Animal animal){
        animal.Call();
    }
}


interface Animal {
    public void Call();
}

class Dog implements Animal {
    @Override
    public void Call() {
        System.out.println("狗叫");
    }
}

class Cat implements Animal {
    @Override
    public void Call() {
        System.out.println("猫叫");
    }
}
